<template>
	<view>
		<view style="width: 100rpx;height: 138rpx;"></view>
		<view class="content">
			<view class="imagebox flex ac">
				<view class="imagebox-left">
					<image mode="aspectFill" :src="datavalue.main_picture"></image>
				</view>
				<view class="imagebox-text">
					<view style="font-size: 30rpx; color:#303030;">{{datavalue.name}}</view>
				</view>
			</view>
			<!-- 撑开 -->
			<view style="width: 100%;height: 130rpx;"></view>
			<view class="list flex ac">
				<view style="width: 200rpx;color: #878787;">抓中时间</view>
				<view style="color: #2D2D2D;">{{datavalue.create_time}}</view>
			</view>
			<view class="list flex ac">
				<view style="width: 200rpx;color: #878787;">过期时间</view>
				<view style="color: #2D2D2D;">{{datavalue.end_time}}</view>
			</view>
			<view class="list flex ac">
				<view style="width: 200rpx;color: #878787;">娃娃状态</view>
				<view v-if="datavalue.status==1" style="color: #2D2D2D;">寄存中</view>
				<view v-if="datavalue.status==2" style="color: #2D2D2D;">已发货</view>
				<view v-if="datavalue.status==3" style="color: #2D2D2D;">主动兑换积分</view>
				<view v-if="datavalue.status==4" style="color: #2D2D2D;">过期兑换积分</view>
			</view>
			<!-- 撑开 -->
			<view style="width: 100%;height: 130rpx;"></view>
			<view class="buttombox" @click="application()">申请发货</view>

		</view>
	</view>
</template>

<script>
	import {
		request
	} from "@/static/common.js";
	export default {
		data() {
			return {
				indexvalue: '',
				datavalue: [],
				dataid: '',
			}
		},

		onLoad(e) {
			// var obj = JSON.parse(decodeURIComponent(e.data))
			// this.data = obj
			this.indexvalue = e.index

			// 获取数据
			let data = uni.getStorageSync('key');
			// console.log(data,"哒哒======")

			let arr = data
			let indexa = this.indexvalue // 假设我们想将3（即索引2的项）移动到第一位
			let item = arr.splice(indexa, 1)[0] // 从数组中移除该项并获得它
			arr.unshift(item) // 将该项插入到数组的开头

			let sliceA = arr.slice(0, 1)
			this.datavalue = sliceA[0]
			this.dataid = sliceA[0].id
		},

		methods: {
			application(e) {
				uni.navigateTo({
					url: '/pages/delivery/delivery?id=' + this.dataid + '&index=' + this.indexvalue
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F8FAFC;
	}

	.content {
		width: 96%;
		height: 800rpx;
		background-color: #ffffff;
		border-radius: 0 20rpx 20rpx 0;
		box-shadow: 0 0.10667rem 0.53333rem 0 rgba(0, 0, 0, .06);
		padding: 0 0 0 30rpx;
		position: relative;
	}

	.imagebox {
		position: absolute;
		left: 20rpx;
		top: -130rpx;
		width: 100%;
		height: 300rpx;
	}


	.imagebox-left {
		width: 200rpx;
		height: 200rpx;
		border: 1px solid #F1F1F1;
		padding: 10rpx;
		border-radius: 20rpx;
	}

	.imagebox-left image {
		width: 100%;
		height: 100%;
		border-radius: 20rpx;
	}

	.imagebox-text {
		width: 460rpx;
		height: 83rpx;
		margin-top: 100rpx;
		margin-left: 20rpx;
		font-weight: bold;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.list {
		padding: 25rpx 0;
		border-bottom: 1rpx solid #E9E9E9;
		font-size: 28rpx;
	}

	.buttombox {
		// background-color:#353535;
		background-color: #A47FF2;
		width: 500rpx;
		height: 90rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		color: #ffffff;
		border-radius: 50rpx;
		margin: 0 auto;
	}
</style>